
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports _2bMatesSite.BO

Namespace _2bMatesSite
	''' <summary>
	''' Summary description for look_and_feel.
	''' </summary>
	Public Partial Class change_background
		Inherits BaseWebPage
		Protected btnPreveiewTheme As System.Web.UI.WebControls.Button
		Protected imgOrangeTheme As System.Web.UI.WebControls.Image
		Protected rbGreenTheme As System.Web.UI.WebControls.RadioButton
		Protected imgGreenTheme As System.Web.UI.WebControls.Image
		Protected rbOrangeTheme As System.Web.UI.WebControls.RadioButton
		Protected imgTemplateOrange As System.Web.UI.WebControls.Image
		Protected imgTemplateGreen As System.Web.UI.WebControls.Image
		Protected rbDefaultOrange As System.Web.UI.WebControls.RadioButton
		Protected rbDefaultGreen As System.Web.UI.WebControls.RadioButton
		Protected lbPreviewOrange As System.Web.UI.WebControls.LinkButton
		Protected lbPreviewGreen As System.Web.UI.WebControls.LinkButton

		Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
			' Put user code to initialize the page here
			' this.pageTemplate.PageTitle = PageTitles.CHANGE_BACKGROUND_PAGE;

			Dim usr As User = Me.LoggedUser

			If usr = Nothing Then
				Common.Utils.RedirectToLoginPage(Page)
			End If

			' init page from XML
			Me.initPageTitles(Constants.CHANGE_BACKGROUND, "", Form1, Nothing, Nothing)
			Me.initAdvertisements(Form1, Nothing)

			' init bg image URL
			If usr.BGImageURL <> Nothing AndAlso usr.BGImageURL <> "" Then
				txtBGImageURL.Text = usr.BGImageURL
			End If

			'init bg .wav file URL
			If usr.WAVURL <> Nothing AndAlso usr.WAVURL <> "" Then
				txtWAVURL.Text = usr.WAVURL
			End If
		End Sub

		#region Web Form Designer generated code
		Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
			'
			' CODEGEN: This call is required by the ASP.NET Web Form Designer.
			'
			InitializeComponent()
			MyBase.OnInit(e)
		End Sub

		''' <summary>
		''' Required method for Designer support - do not modify
		''' the contents of this method with the code editor.
		''' </summary>
		Private Sub InitializeComponent()

		End Sub
#End Region
		Protected Sub btnDone_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Dim usr As User = Me.LoggedUser

			If usr <> Nothing Then
				' set bg image URL

				Dim bgImage As String = Request.Params(txtBGImageURL.UniqueID).Trim()

				If bgImage <> Constants.BG_IMAGE_DEFAULT_TEXT Then
					bgImage = bgImage.Substring(0, Math.Min(bgImage.Length, Constants.TEXT_FIELD_URL_CHARS))
					usr.BGImageURL = bgImage
				End If

				' set bg .wav file URL

				Dim bgMusic As String = Request.Params(txtWAVURL.UniqueID).Trim()

				If bgMusic <> Constants.BG_WAV_DEFAULT_TEXT Then
					bgMusic = bgMusic.Substring(0, Math.Min(bgMusic.Length, Constants.TEXT_FIELD_URL_CHARS))
					usr.WAVURL = bgMusic
				End If
				usr.EditDate = DateTime.Now
				usr.Save()
				lblMessage.Visible = True
				txtBGImageURL.Text = bgImage
				txtWAVURL.Text = bgMusic
			End If
		End Sub

		====================
        ' This public property was added by conversion wizard to allow the access of a protected, autogenerated member variable Form1.
		====================
        Public ReadOnly Property Form1() As System.Web.UI.HtmlControls.HtmlForm
            Get
                Return Migrated_Form1
            End Get
        End Property
        'set { Migrated_Form1 = value; }
    End Class
End Namespace






